package com.eversec.model.filetable;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * 文件校对table表格渲染器
 * 
 * @author lilizhao
 * 
 */
public class FileCheckTableRender extends DefaultTableCellRenderer {

	private static final long serialVersionUID = 5858086807086611465L;

	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
		if (value instanceof Boolean) {
			if (value == Boolean.TRUE) {
				this.setBackground(Color.GREEN);
			} else if (value == Boolean.FALSE) {
				this.setBackground(Color.RED);
			} 
		} else {
			if (isSelected) {
				this.setBackground(table.getSelectionBackground());
			} else {
				this.setBackground(table.getBackground());
			}
		}
			
		return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
	}

}
